<header id="topbar" class="">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="stats/account_login/">登录账号查询</a>
            </li>
        </ol>
    <div class="topbar-right">
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
    </div>
</header>

<section id="content">
    <% if(items.length > 0){%>
    <div class="panel overflow" >
        <table class="table table-striped fs13" id="main-list">
            <thead>
                <tr class="bg-light">
                    <th>用户id</th>
                    <th>用户昵称</th>
                    <th>注册时间</th>
                    <th>设备id</th>
                    <th>注册ip</th>
                    <th>最后登陆ip</th>
                    <th>渠道号</th>
                    <th>绑定手机号</th>
                    <th>当前余额</th>
                    <th>充值金额</th>
                    <th>提现金额</th>
                    <th>购彩金额</th>
                    <th>购彩中奖金额</th>
                    <th>电玩城参与金额</th>
                    <th>电玩城中奖金额</th>
                </tr>
            </thead>
            <tbody class="admin-form">

                <% var moment = require('moment'); %>
                <%if(items.length > 0){
                    _.each(items, function(item){
                        ur = item.user_stats.recharge || {};
                        up = item.user_stats.pay || {};
                        user_withdraw = item.user_stats.withdraw || {};
                        uw = item.user_stats.win || {};
                        ub = item.user_stats.bonus || {};
                        dl = item.daily_stats.lottery || {};
                        dk = item.daily_stats.kfc || {};
                        df = item.daily_stats.fruit || {};
                        db = item.daily_stats.bull || {};
                        ex = ex = JSON.parse(item.extend) || {};
                %>
                    <tr data-id="<%= item.id %>" >
                        <td><a href="/#stats/account/?id=<%= item.id %>"><%= item.id %></a></td>
                        <td><%= item.user_name %></td>
                        <td><%= item.created_at %></td>
                        <td><%= item.user_stats.aid %></td>
                        <td><%= ex.ip %></td>
                        <td><%= item.ip %></td>
                        <td><%= item.channel %></td>
                        <td><%= item.phone %></td>
                        <td><%= item.balance %></td>
                        <td><%= (ur.total || 0).toFixed(2)%></td>
                        <td><%= parseFloat(item.withdraw) + (user_withdraw.total || 0) %></td>
                        <td><%= (up.total || 0).toFixed(2)%></td>
                        <td><%= ((uw.total || 0) + (ub.total || 0)).toFixed(2)  %></td>
                        <td><%= ((dl.bet_amount || 0) + (db.bet_amount || 0) +
                                        (dk.bet_amount || 0) + (df.bet_amount || 0)).toFixed(2) %></td>
                        <td><%= ((dl.win_count || 0) + (db.win_count || 0) +
                                        (dk.win_count || 0) + (df.win_count || 0)).toFixed(2) %></td>
                    </tr>
                <% }) %>
            <%}%>
            </tbody>
        </table>
    </div>
    <div><div class="pull-left" id="page-tips"></div><div id="paginator"></div></div>
    <% }else{ %>
    <h4 class="text-muted">请从右侧进行搜索...</h4>
    <% } %>
</section>

<aside id="sidebar_right" class="nano">
    <div class="p20 admin-form">

        <h4 class="mt5 text-muted fw500">过滤条件：</h4>

        <hr class="short">
        <h6 class="fw400">设备ID</h6>
        <div class="section mb15">
            <label for="searchDeviceId" class="field prepend-icon">
                <input title="设备ID" type="text" id="searchDeviceId" class="gui-input" placeholder="设备ID" value="<%= searched.device_id  %>">
                <label for="searchDeviceId" class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>
        <hr class="short">

        <h6 class="fw400">注册ip</h6>
        <div class="section mb15">
            <label for="searchRegisterIp" class="field prepend-icon">
                <input title="注册ip" type="text" id="searchRegisterIp" class="gui-input" placeholder="注册ip" value="<%= searched.register_ip  %>">
                <label for="searchRegisterIp" class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>
        <hr class="short">

        <h6 class="fw400">最后登陆ip</h6>
        <div class="section mb15">
            <label for="searchLastLoginIp" class="field prepend-icon">
                <input title="最后登陆ip" type="text" id="searchLastLoginIp" class="gui-input" placeholder="最后登陆ip" value="<%= searched.last_login_ip  %>">
                <label for="searchRegisterIp" class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>
        <hr class="short">

        <button class="btn btn-default btn-block" type="button" id="search">搜索</button>

    </div>
</aside>
